***Importing the dataset****
clear all
cd "Z:\postdoc\eksperiment 1"
use "Z:\postdoc\eksperiment 1\Participation_eyes_and_social_proof.dta", clear

***recode***
gen completedbeforereminder=0

display date("11-06-2013", "MDY") // returns the value "19668"
recode completedbeforereminder 0=1 if closetime<tc(05nov2013 12:00:00)

**************
***ANALYSIS***
**************


***Analysing response rate before reminders**********************************************

***overall response rate***
tab completedbeforereminder

***response rate and treatments***
tab completedbeforereminder social_proof_invitation

tab completedbeforereminder eyes_present_invitation 

prtest completedbeforereminder, by(social_proof_invitation)

prtest completedbeforereminder, by(eyes_present_invitation)

***response rate and treatment, interacted

logit completedbeforereminder i.social_proof_invitation##i.eyes_present_invitation
eststo before

***Illustrating response rate before reminders***
estimates restore before
margins, over(social_proof_invitation eyes_present_invitation)
marginsplot, bydimension(social_proof_invitation, elabel(1 "No Eyes on Invitation" 2 "Eyes on Invitation" )) ///
             plotopts(barwidth(0.7)) recast(bar) ylabel(0(0.1)0.3, gmin grid) xlabel(0 "No Social Proof" 1 "Social Proof on invitation") scheme(s1mono) xtitle("") ytitle("Response rate") 
             graph export response_before_reminder.emf, replace

***Analysing response rate for the people recieving reminders**********************************************


***response rate and treatments***
tab completed social_proof_reminder

tab completed eyes_present_reminder 

prtest completed, by(social_proof_reminder)

prtest completed, by(eyes_present_reminder)

***response rate and treatment, interacted

logit completed i.social_proof_reminder##i.eyes_present_reminder
eststo after

***Illustrating response rate after reminders***
estimates restore after
margins, over(social_proof_reminder eyes_present_reminder)
marginsplot, bydimension(social_proof_reminder, elabel(1 "No Eyes on reminder" 2 "Eyes on reminder" )) ///
             plotopts(barwidth(0.7)) recast(bar) ylabel(0(0.1)0.3, gmin grid) xlabel(0 "No Social Proof" 1 "Social Proof on reminder") scheme(s1mono) xtitle("") ytitle("Response rate") 
			 graph export response_after_reminder.emf, replace
			 


			 
****Analyzing final response rate with interactions between all the treatments****
tab completed

logit completed i.eyes_present_invitation##i.social_proof_invitation##i.social_proof_reminder##i.eyes_present_reminder
margins, over(i.eyes_present_invitation i.social_proof_invitation i.social_proof_reminder i.eyes_present_reminder)
margins, over(i.eyes_present_invitation i.social_proof_invitation i.social_proof_reminder i.eyes_present_reminder) pwcompare(groups) //Hey, look, "effects"!



***Analyzing power of experiment***
sampsi .2 .2686, alpha(.05) power(.8) onesided //working backwards to find power=.08




		 
			 

